/*
 * Copyright 2007 Jeffrey Palm
 */

import java.io.*;
import java.util.*;

/**
 * Main entry to creating the various libraries
 */
public class Gen extends App {

  public static void main(String[] args) throws Exception {
    new Gen().realMain(args);
  }

  private File outdir;

  void readOptions(String[] args) {
    for (int i=0; i<args.length;) {
      String arg = args[i++];
      if (arg.equals("-d")) {
        outdir = new File(args[i++]);
      }
    }
  }

  void go() throws Exception {
    Parser p = new Parser(isVerbose(),new Scanner(new FileInputStream(getSpec())));
    World w = p.parse();
    if (outdir != null) outdir.mkdirs();
    Sink[] ss = {
      new JavaSink(outdir),
      new PHPSink(outdir),
      new RubySink(outdir),
      new PythonSink(outdir),
      new PerlSink(outdir),
    };
    for (Sink s : ss) s.output(w);
  }

}